From: Barnabás Pőcze Date: Tue, 16 Jan 2024 22:41:24 +0000 (+0100) Subject: status/backlight: Do only one dbus call per local change X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~137 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c227d0b38e69e4e9d628264a6e8644bd148d7061;p=gnome-shell.git status/backlight: Do only one dbus call per local change The values of the two control widgets are syncronized, meaning that both emit signals when the local value changes, regardless which one is visible and is actually used by the user. This is not ideal because it leads to two dbus calls per local change. To alleviate this, only consider changes from the widget that is visible. Part-of: --- diff --git a/js/ui/status/backlight.js b/js/ui/status/backlight.js index ca901d547..686ed3361 100644 --- a/js/ui/status/backlight.js +++ b/js/ui/status/backlight.js @@ -177,11 +177,15 @@ class KeyboardBrightnessToggle extends QuickMenuToggle { this._discreteItem, 'value', GObject.BindingFlags.SYNC_CREATE); - this._sliderItemChangedId = this._sliderItem.connect('notify::value', - () => (this._proxy.Brightness = this._sliderItem.value)); + this._sliderItemChangedId = this._sliderItem.connect('notify::value', () => { + if (this._sliderItem.visible) + this._proxy.Brightness = this._sliderItem.value; + }); - this._discreteItemChangedId = this._discreteItem.connect('notify::value', - () => (this._proxy.Brightness = this._discreteItem.value)); + this._discreteItemChangedId = this._discreteItem.connect('notify::value', () => { + if (this._discreteItem.visible) + this._proxy.Brightness = this._discreteItem.value; + }); } _sync() {